package com.yimi.policyservice.repository;

import com.yimi.policyservice.entity.base.policy.PolicyComminsureItemPrice;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface PolicyComminsureItemPriceRepository extends JpaRepository<PolicyComminsureItemPrice,String> {

    @Transactional
    @Modifying
    @Query(value = "delete  from t_policy_comminsure_item_price where product_id in ?1",nativeQuery = true)
     void deleteByProductId(List<String> ids) ;


    @Query(value = "select * from t_policy_comminsure_item_price where product_id =?1 order by order_index asc ",nativeQuery = true)
    List<PolicyComminsureItemPrice> findByProductId(String id);
}
